<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('出库流水列表')"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li>
                            <label>任务号：</label>
                            <input type="text" name="taskNo"/>
                        </li>
                        <li>
                            <label>托盘条码：</label>
                            <input type="text" name="trayCode"/>
                        </li>
                        <li>
                            <label>巷道：</label>
                            <input type="text" name="roadwayId"/>
                        </li>
                        <li>
                            <label>货位：</label>
                            <input type="text" name="cargoSpaceId"/>
                        </li>
                        <li>
                            <label>货位名称：</label>
                            <input type="text" name="cargoSpaceName"/>
                        </li>
                        <li>
                            <label>出库类型：</label>
                            <select class="form-control" name="inOrOut" id="inOrOut">
                            </select>
                        </li>
                        <li>
                            <label>物资编号：</label>
                            <input type="text" name="productId"/>
                        </li>
                        <li>
                            <label>物资名称：</label>
                            <input type="text" name="productName"/>
                        </li>
                        <li>
                            <label>批号：</label>
                            <input type="text" name="lotNo"/>
                        </li>
                        <li>
                            出库单编号：
                            <input type="text" name="inOrOutId"/>
                        </li>
                        <li>
                            子件条码：
                            <input type="text" name="barcodeDetail"/>
                        </li>
                        <br/>
                        <li>
                            <label>起止时间：</label><input type="text" placeholder="请单击选择开始时间：" name="startTime"
                                                       id="startTime"/>---
                            <input type="text" placeholder="请单击选择结束时间：" name="finishTime" id="finishTime"/>
                        </li>

                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="btn-group-sm" id="toolbar" role="group">
            <!--                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="search:outOrder:add">-->
            <!--                    <i class="fa fa-plus"></i> 添加-->
            <!--                </a>-->
            <!--                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="search:outOrder:edit">-->
            <!--                    <i class="fa fa-edit"></i> 修改-->
            <!--                </a>-->
            <!--                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="search:outOrder:remove">-->
            <!--                    <i class="fa fa-remove"></i> 删除-->
            <!--                </a>-->
            <a class="btn btn-warning" onclick="$.table.exportExcel()">
                <i class="fa fa-download"></i> 导出
            </a>
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('search:outOrder:edit')}]];
    var removeFlag = [[${@permission.hasPermi('search:outOrder:remove')}]];
    var prefix = ctx + "search/outOrder";

    layui.use('laydate', function () {
        var laydates = layui.laydate;
        laydates.render({
            elem: '#startTime'
            , type: 'datetime',
            /* ,range: '到' */
            format: 'yyyy-MM-dd HH:mm:ss'
        })
    })

    layui.use('laydate', function () {
        var laydates = layui.laydate;
        laydates.render({
            elem: '#finishTime'
            , type: 'datetime',
            /* ,range: '到' */
            format: 'yyyy-MM-dd HH:mm:ss'
        })
    })

    //出库作业类型
    $(document).ready(function () {
        $.post("/bas/inoroutType/list", {inOrOutTypeId: 2}, function (data) {

            $("#inOrOut").append("<option value=''>----请选择----</option>");
            // alert(data.rows[0].inOrOut);
            for (var i = 0; i < data.total; i++) {
                $("#inOrOut").append("<option value=" + data.rows[i].inOrOut + ">" + data.rows[i].inOrOutTypeName + "</option>");
            }
        });
    });

    $(function () {
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            modalName: "出库流水",
            columns: [{
                checkbox: true
            },
                {
                    field: 'jobId',
                    title: '作业编号',
                    visible: false
                },
                {
                    field: 'jobDetailId',
                    title: '作业明细'
                },
                {
                    field: 'status',
                    title: '状态',
                    formatter: function (value, row, index) {
                        if (value == 1) {
                            return "未执行";
                        } else if (value == 0) {
                            return "待执行";
                        } else if (value == 3) {
                            return "正执行";
                        } else if (value == 4) {
                            return "已完成";
                        } else if (value == 5) {
                            return "已作废";
                        }
                    }
                },
                {
                    field: 'taskNo',
                    title: '任务号'
                },
                {
                    field: 'trayCode',
                    title: '托盘条码'
                },
                {
                    field: 'roadwayId',
                    title: '巷道'
                },
                {
                    field: 'cargoSpaceId',
                    title: '货位'
                },
                {
                    field: 'cargoSpaceName',
                    title: '货位名称'
                },
                {
                    field: 'inOrOut',
                    title: '出库类型',
                    formatter: function (value, row, index) {
                        if (value == 10) {
                            return "整托出库";
                        } else if (value == 11) {
                            return "拣选出库";
                        } else if (value == 12) {
                            return "空托盘出库";
                        } else if (value == 14) {
                            return "盘点出库";
                        } else if (value == 20) {
                            return "移库";
                        }
                    }
                },
                {
                    field: 'barcodeDetail',
                    title: '子件条码'
                },
                {
                    field: 'productId',
                    title: '物资编号'
                },
                {
                    field: 'productName',
                    title: '物资名称'
                },
                {
                    field: 'lotNo',
                    title: '批号'
                },
                {
                    field: 'outQuantity',
                    title: '出库数量'
                },
                {
                    field: 'inOrOutId',
                    title: '出库单编号'
                },
                {
                    field: 'startTime',
                    title: '开始时间'
                },
                {
                    field: 'finishTime',
                    title: '完成时间'
                }]
        };
        $.table.init(options);
    });
</script>
</body>
</html>